home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / ptv1n4.arc / GET.PAS < prev    next >
Pascal/Delphi Source File  |  1990-09-13  |  835b  |  27 lines

  1. { get.pas -- Retrieve a string from the passive TSR's buffer }
  2. program get;
  3. uses crt, utransfer;
  4. var
  5.    s : string;       { String to receive transfer }
  6.    n : word;         { Number of bytes transferred }
  7.    bufSize : word;   { Returned by Status }
  8.    typeCode : byte;  { Returned by Status }
  9.    errorCode : byte; { Returned by Status }
  10. begin
  11.    Status( bufSize, typeCode, errorCode );
  12.    if typeCode <> 1 then
  13.    begin
  14.       writeln( 'Data is not a string' );
  15.       halt( 1 )
  16.    end; { if }
  17.    fillchar( s, sizeof(s), 0 );     { Erase any leftovers in s }
  18.    n := GetBlock( @s, sizeof(s) );  { Get data from TSR }
  19.    if transferError <> 0 then
  20.    begin
  21.       writeln( 'ERROR: Code #', transferError );
  22.       halt( transferError )
  23.    end; { if }
  24.    writeln( 'string = ', s )        { Display results }
  25. end.
  26.  
  27.